import unittest

from appium import webdriver
from appium.options.android import UiAutomator2Options

from 水质.utils.Logger import logger
from 水质.utils.click import clickText
from 水质.个人中心.个人中心 import test_msg
from 水质.登录.登录 import input_account

capabilities = dict(
    platformName='Android',
    automationName='uiautomator2',
    deviceName='333968a19905',
    appPackage='com.standards.oceanprotect',
    appActivity='com.standards.oceanprotect.module.common.GuideActivity',

)

appium_server_url = 'http://localhost:4723'


class TestAppium(unittest.TestCase):
    def setUp(self) -> None:
        self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))
        # 设置每隔10毫秒重新查找元素超过3秒未找到抛出异常
        self.driver.implicitly_wait(5)

    def tearDown(self) -> None:
        if self.driver:
            self.driver.quit()

    def test_flux_module(self) -> None:
        input_account(self)
        clickText(self.driver,"个人中心")
        test_msg(self.driver)
        #checkTableWater(self.driver)
        #checkTableArea(self.driver)
        logger.log("test_flux_module：测试完毕")


if __name__ == '__main__':
    unittest.main()
